import { useRef } from 'react';
import { ReactJexcel } from 'react-jexcel';

const Excel = () => {
    const ref = useRef(null)
    const addRow = () => {
        (ref.current as any).jexcel.insertRow()
    }
    const data = [
        ['Mazda', 2001, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000],
        ['Pegeout', 2010, 5000],
        ['Honda Fit', 2009, 3000],
        ['Honda CRV', 2010, 6000],
    ];
    return (
        <>
            <ReactJexcel
                data={data}
                rowResize={true}
                allowExport={true}
                ref={ref}
            />
            <div>
                <button onClick={addRow}>addRow</button>
            </div>
        </>
    )
};

export default Excel